import request from '@/utils/axios'
//import Vue from 'vue'
//import Vuex from 'vuex'

// import Login from '@/pages/user/Login.vue'
// import Register from '@/pages/user/Register.vue'

export function getImgs(){
    return request({
        url: '/imglist',
        method: 'get'
    })
}

//加了data
export function getGoodsList(params) {
    return request({
    url: '/goodslist',
    method: 'get',
    params
 })
}

export function category() {
    return request({
    url: '/category',
    method: 'get',
     })
    }

//加了data
    export function detail(data) {
        return request({
        url: '/goodsinfo',
        method: 'get',
        data
         })
        }
//1.用户登录
export function login(data){
    return request({
        url:'/login',
        method:'post',
        data
    })
}

//2.用户注册
export function register(data){
    return request({
        url:'/register',
        method:'post',
        data
    })
}

//3.获取用户信息
export function getUserInfo(){
    return request({
        url:'/user',
        method:'get'
    })
}


export function logout(state){
    return request({
        url:'/logout',
        method:'get',
    })
}

export function getGoodsInfo(data){
    return request({
        url:'/goodsinfo',
        method:'get',
        params:data
    })
}

export default {
    login,
    getImgs,
    getGoodsList,
    category,
    detail,
    register,
    getUserInfo,
    getGoodsInfo
}